/* ----------------------------------------------------
@Time    : 2020/5/15 12:11 下午
@Author  : Hugo Yuan
@Email   : hugolxq@gmail.com
@File    : GetString.go
---------------------------------------------------- */
package RequestsV3

import (
	"encoding/json"
	"strconv"
)

func GetString(i interface{}) string {
	switch v := i.(type) {
	case string:
		return v
	case []byte:
		return string(v)
	case int:
		return strconv.Itoa(v)
	case bool:
		return strconv.FormatBool(v)
	default:
		bytes, _ := json.Marshal(v)
		return string(bytes)
	}
}
